#import <UIKit/UIKit.h>
#import "SFUConstants.h"
#import "SFUEventSearchEngine.h"

// Constants for the search field groups
enum {
	KeywordsGroup
};

// Constants for the search fields and controls
enum {
	KeywordsField,
	KeywordsMatchControl
};

/**
 * An EventSearchView is an object representing the view that provides
 * the complete form for searching events.
 *
 * A MapBuildingSearchDelegate must be set to respond to events from
 * the map building search viewer.
 *
 * @author      James Lin
 * @version     0.8.8
 * @since       0.8.3
 * @see         MapBuildingSearchDelegate
 */
@interface EventSearchView : UIViewController <UITextFieldDelegate, UITableViewDelegate, 
												UITableViewDataSource> {
	id<SFUEventSearchEngineDelegate> searchDelegate;      // Delegate handling search results
	UITableView*                     searchTableView;     // Table view for search parameters
	UITextField*                     keywordField;        // Text field for search keywords
	UISegmentedControl*              keywordMatchControl; // Toggle button for keyword match mode
	UINavigationController*          parentNav;           // The parent navigation controller
	NSString*                        keywordString;       // The inputted keyword string
	BOOL                             matchAllKeywords;    // The keyword match mode
}

@property (nonatomic, retain) UITextField* keywordField;
@property (nonatomic, retain) UISegmentedControl* keywordMatchControl;
@property (nonatomic, retain) NSString* keywordString;
@property BOOL matchAllKeywords;

/**
 * Retrieve the shared instance of the event search view.
 *
 * @return  the shared instance of EventSearchView
 */
+ (EventSearchView*)sharedEventSearchView;

/**
 * Display the event search view.
 *
 * Pushes this view onto the navigation controller stack of the parent
 * view. Upon tapping the back button, the view is automatically 
 * popped off the top of the navigation stack.
 *
 * @param navController  the navigation controller of the parent view
 * @param delegate       the delegate handling event search results
 */
- (void)displayWithNavController:(UINavigationController*)navController
				  searchDelegate:(id<SFUEventSearchEngineDelegate>)delegate;

@end
